package com.example.jpa.entity;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import lombok.Data;

import java.util.UUID;

/**
 * 资产实体类，映射 PostgreSQL 中的资产表
 */
@Data
@Entity
@Table(name = "asset")  // 表名与实体类名一致，可根据实际表名调整
public class Asset {

    /**
     * 主键 ID，UUID 类型
     */
    @Id
    @Column(columnDefinition = "uuid", nullable = false)
    private UUID id;

    /**
     * 创建时间，对应 PostgreSQL 的 int8（BIGINT，通常存储时间戳毫秒数）
     */
    @Column(name = "created_time", columnDefinition = "int8")
    private Long createdTime;

    /**
     * 附加信息，字符串类型
     */
    @Column(name = "additional_info", columnDefinition = "varchar")
    private String additionalInfo;

    /**
     * 客户 ID，UUID 类型
     */
    @Column(name = "customer_id", columnDefinition = "uuid")
    private UUID customerId;

    /**
     * 资产配置文件 ID，UUID 类型
     */
    @Column(name = "asset_profile_id", columnDefinition = "uuid")
    private UUID assetProfileId;

    /**
     * 资产名称
     */
    @Column(name = "name", columnDefinition = "varchar")
    private String name;

    /**
     * 资产标签
     */
    @Column(name = "label", columnDefinition = "varchar")
    private String label;

    /**
     * 租户 ID，UUID 类型
     */
    @Column(name = "tenant_id", columnDefinition = "uuid")
    private UUID tenantId;

    /**
     * 资产类型
     */
    @Column(name = "type", columnDefinition = "varchar")
    private String type;

    /**
     * 外部 ID，UUID 类型
     */
    @Column(name = "external_id", columnDefinition = "uuid")
    private UUID externalId;

    /**
     * 版本号，int8 类型（通常用于乐观锁或版本控制）
     */
    @Column(name = "version", columnDefinition = "int8")
    private Long version;
}
